﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Business.Models;
using Business.PreciseLibraryManagement;
using Business.PreciseLibraryManagement.Dto;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Domain.Repositories;

namespace Business.Controllers
{
    /// <summary>
    /// 精确调拨控制器
    /// </summary>
    [RemoteService]
    [Area("Business")]
    [Route("api/business/preciseLibrary")]
    public class PreciseLibraryController : AbpController
    {
        private readonly IPreciseLibraryAppService _preciseLibraryAppService;

        public PreciseLibraryController(IPreciseLibraryAppService preciseLibraryAppService)
        {
            _preciseLibraryAppService = preciseLibraryAppService;
        }

        /// <summary>
        /// 新增或修改精确调拨
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("preciseLibrary-post")]
        public  Task<PreciseLibraryDto> CreateOrUpdate(PreciseLibraryDto input)
        {
            return _preciseLibraryAppService.CreateOrUpdate(input);
        }

        /// <summary>
        /// 获取精确调拨列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("preciseLibrary-get")]
        public  Task<PagedResultDto<PreciseLibraryDto>> GetPreciseLibraryList(PreciseLibraryInputDto input)
        {
            return _preciseLibraryAppService.GetPreciseLibraryList(input);
        }

        /// <summary>
        /// 删除精确调拨
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpDelete]
        [Route("preciseLibrary-delete")]
        public  Task DeletePreciseLibrary(List<Guid> ids)
        {
            return _preciseLibraryAppService.DeletePreciseLibrary(ids);
        }

        /// <summary>
        /// 反填精确调拨
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("preciseLibrary-find")]
        public  Task<PreciseLibraryDto> GetPreciseLibraryForEdit(Guid id)
        {
            return _preciseLibraryAppService.GetPreciseLibraryForEdit(id);
        }

    }
}
